﻿using DocumentFormat.OpenXml.Presentation;
using Magicodes.ExporterAndImporter.Core;
using Magicodes.ExporterAndImporter.Excel;
using OfficeOpenXml.Table;
using System;
using System.Collections.Generic;
using System.Text;

namespace NP.BPMReportPlatform.CourseTrain.Dtos
{
    public class CourseReportDto
    {
        public class ReportSearchDto : PagedAndSortedRequestDto
        {
            public string WorkNumber { get; set; }

            public string UserName { get; set; }

            public string InstanceNumber { get; set; }

            public string ProjectName { get; set; }

            public DateTime Date { get; set; }
        }

        [ExcelExporter(Name = "报表数据", TableStyle = TableStyles.Light10, AutoFitAllColumn = true)]
        public class CourseTrainTaskReportDto
        {
            /// <summary>
            /// BPM流程ID
            /// </summary>
            [ExporterHeader("BPM流程ID")]
            public string InstanceNumber { get; set; }
            /// <summary>
            /// 培训编码
            /// </summary>
            [ExporterHeader("培训编码")]
            public string CourseTrainCode { get; set; }
            /// <summary>
            /// 经办人工号
            /// </summary>
            [ExporterHeader("经办人工号")]
            public string WorkNumber { get; set; }
            /// <summary>
            /// 经办人姓名
            /// </summary>
            [ExporterHeader("经办人姓名")]
            public string CreateUserName { get; set; }
            /// <summary>
            /// 所属公司
            /// </summary>
            [ExporterHeader("经办人公司")]
            public string Company { get; set; }
            /// <summary>
            /// 所属部门
            /// </summary>
            [ExporterHeader("经办人部门")]
            public string Department { get; set; }
            /// <summary>
            /// 培训年月
            /// </summary>
            [IEIgnore]
            public DateTime? TrainDate { get; set; }

            /// <summary>
            /// 证书截止日期
            /// </summary>
            [ExporterHeader(DisplayName = "证书截止日期")]
            public string TrainDateFormat
            {
                get
                {
                    return this.TrainDate?.ToString("yyyy年MM月");
                }
            }

            /// <summary>
            /// 培训项目
            /// </summary>
            [ExporterHeader("培训项目")]
            public string TraningProject { get; set; }
            /// <summary>
            /// 培训课程
            /// </summary>
            [ExporterHeader("培训课程")]
            public string CourseName { get; set; }
            /// <summary>
            /// 实际听课人数
            /// </summary>
            [ExporterHeader("实际听课人数")]
            public string ActrualUsers { get; set; }
            /// <summary>
            /// 培训预算
            /// </summary>
            [ExporterHeader("培训预算")]
            public decimal? TrainUserBudget { get; set; }
            /// <summary>
            /// 组织部门费用
            /// </summary>
            [ExporterHeader("组织部门费用")]
            public decimal? OrgCostTotal { get; set; }
            /// <summary>
            /// 参训人员费用
            /// </summary>
            [ExporterHeader("参训人员费用")]
            public decimal? TrainTotalFee { get; set; }
            /// <summary>
            /// 员工报销的课程费
            /// </summary>
            [ExporterHeader("员工报销的课程费")]
            public decimal? CourseFee { get; set; }
            /// <summary>
            /// 是否超标
            /// </summary>
            [IEIgnore]
            public bool IsOutStandard { get; set; }

            /// <summary>
            /// 证书截止日期
            /// </summary>
            [ExporterHeader("是否超标")]
            public string IsOutStandardFormat
            {
                get
                {
                    return this.IsOutStandard == true ? "是" : "否";
                }
            }
        }

        [ExcelExporter(Name = "报表数据", TableStyle = TableStyles.Light10, AutoFitAllColumn = true)]
        /// <summary>
        /// 导出实体
        /// </summary>
        public class ExportCourseOutput
        {
            /// <summary>
            /// BPM流程ID
            /// </summary>
            [ExporterHeader("BPM流程ID")]
            public string InstanceNumber { get; set; }

            /// <summary>
            /// 流程状态
            /// </summary>
            [ExporterHeader("流程状态")]
            public string StatusName { get; set; }

            /// <summary>
            /// 经办人工号
            /// </summary>
            [ExporterHeader("经办人工号")]
            public string WorkNumber { get; set; }

            /// <summary>
            /// 经办人姓名
            /// </summary>
            [ExporterHeader("经办人姓名")]
            public string UserName { get; set; }

            /// <summary>
            /// 所属公司
            /// </summary>
            [ExporterHeader("经办人公司")]
            public string Company { get; set; }

            /// <summary>
            /// 所属部门
            /// </summary>
            [ExporterHeader("经办人部门")]
            public string Department { get; set; }

            /// <summary>
            /// 培训年月
            /// </summary>
            [IEIgnore]
            public DateTime? TrainDate { get; set; }

            /// <summary>
            /// 证书截止日期
            /// </summary>
            [ExporterHeader(DisplayName = "证书截止日期")]
            public string TrainDateFormat
            {
                get
                {
                    return this.TrainDate?.ToString("yyyy年MM月");
                }
            }

            /// <summary>
            /// 培训项目
            /// </summary>
            [ExporterHeader("培训项目")]
            public string ProjectName { get; set; }

            /// <summary>
            /// 培训人数
            /// </summary>
            [ExporterHeader("培训人数")]
            public int? TrainUserNumber { get; set; }

            /// <summary>
            /// 培训预算
            /// </summary>
            [ExporterHeader("培训预算")]
            public decimal? TrainBudget { get; set; }

            /// <summary>
            /// 用餐总次数
            /// </summary>
            [ExporterHeader("用餐总次数")]
            public int? MealFrequency { get; set; }
        }

        /// <summary>
        /// 报销费用导出实体
        /// </summary>
        public class ExportCourseExpenseOutput
        {
            /// <summary>
            /// BPM流程ID
            /// </summary>
            [ExporterHeader("BPM流程ID")]
            public string InstanceNumber { get; set; }

            /// <summary>
            /// 流程状态
            /// </summary>
            [ExporterHeader("流程状态")]
            public string StatusName { get; set; }

            /// <summary>
            /// 经办人工号
            /// </summary>
            [ExporterHeader("经办人工号")]
            public string WorkNumber { get; set; }

            /// <summary>
            /// 经办人姓名
            /// </summary>
            [ExporterHeader("经办人姓名")]
            public string UserName { get; set; }

            /// <summary>
            /// 所属公司
            /// </summary>
            [ExporterHeader("所属公司")]
            public string Company { get; set; }

            /// <summary>
            /// 所属部门
            /// </summary>
            [ExporterHeader("所属部门")]
            public string Department { get; set; }

            /// <summary>
            /// 培训年月
            /// </summary>
            [ExporterHeader("培训年月")]
            public string TrainDate { get; set; }

            /// <summary>
            /// 培训项目
            /// </summary>
            [ExporterHeader("培训项目")]
            public string ProjectName { get; set; }

            /// <summary>
            /// 培训人数
            /// </summary>
            [ExporterHeader("培训人数")]
            public string TrainUserNumber { get; set; }

            /// <summary>
            /// 培训预算
            /// </summary>
            [ExporterHeader("培训预算")]
            public string TrainBudget { get; set; }

            /// <summary>
            /// 用餐总次数
            /// </summary>
            [ExporterHeader("用餐总次数")]
            public string MealFrequency { get; set; }
        }
    }
}
